/*
 * Class NPCOption2
 *
 * Version 1.0
 *
 * Saturday, August 23, 2008
 *
 * Created by Palidino76
 */

package net.com.hydroPK.net.packethandler;

import net.com.hydroPK.Engine;
import net.com.hydroPK.model.Player;
import net.com.hydroPK.model.skills.PlayerThieving;
import net.com.hydroPK.npcs.NPC;
import net.com.hydroPK.util.Misc;

public class NPCOption2 implements Packet {
    /**
     * Handles the second NPC option.
     *
     * @param p The Player which the frame should be handled for.
     * @param packetId The packet id this belongs to.
     * @param packetSize The amount of bytes being recieved for this packet.
     */

    public void handlePacket(Player p, int packetId, int packetSize) {
        if (p == null || p.stream == null) {
            return;
        }
        int npcSlot = p.stream.readUnsignedWordBigEndianA();
        int npcType = Engine.npcs[npcSlot].npcType;
        NPC n = Engine.npcs[npcSlot];
        if (n == null) {
            return;
        }
        if (Misc.getDistance(p.absX, p.absY, n.absX, n.absY) > 2) {
            return;
        }
        switch (npcType) {
            case 575: // Hickton
                p.shopHandler.openshop(p, 13);
                p.sendNpcDialogue(0, 575, "Hickton", "What do you want to buy?", "You've got to be interested in " +
                        "one of the skills i support?");
                break;
            case 553: // Aubury
                p.shopHandler.openshop(p, 11);
                p.sendNpcDialogue(0, 553, "Aubury", "What do you want to buy?", "I'm the only rune essence merchant!");
                break;
            case 530: //food/pot shop
                p.shopHandler.openshop(p, 8);
                break;
            case 7967: //range shop
                p.shopHandler.openshop(p, 5);
                break;
            case 532: //fighter shop
                p.shopHandler.openshop(p, 6);
                break;
            case 522: //magic shop
                p.shopHandler.openshop(p, 3);
                break;
            case 494: // Banker
            case 5488: // Magnus Gram
                p.openBank();
                p.requestFaceTo(65535);
                break;

	    case 6390:
                    p.getActionSender().showInterface(p, 583);
                p.getActionSender().setString(p, "<col=ffffff>Dragon Claws 30 Pk Points", 583, 50);
                p.getActionSender().setString(p, "<col=ffffff>5m Sharks 5 Pk Points", 583, 51);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Chain 30 Pk Points", 583, 52);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Skirt 30 Pk Points", 583, 53);
                p.getActionSender().setString(p, "<col=ffffff>Vesta Long 30 Pk Points", 583, 54);
                p.getActionSender().setString(p, "<col=ffffff>Statius Helm 30 Pk Points", 583, 55);
                p.getActionSender().setString(p, "<col=ffffff>Statius Legs 30 Pk Points", 583, 56);
                p.getActionSender().setString(p, "<col=ffffff>Statius Plate 30 Pk Points", 583, 57);
                p.getActionSender().setString(p, "<col=ffffff>15m 10 pk points", 583, 58);
                p.getActionSender().setString(p, "<col=ffffff>20m 15 Pk Points", 583, 59);
                p.getActionSender().setString(p, "<col=ffffff>50m 25 pk points", 583, 71);
                p.getActionSender().setString(p, "<col=ffffff>Guthan Set 0 Pk Points", 583, 60);
                p.getActionSender().setString(p, "<col=ffffff>Dharoks Set 0 Pk Points", 583, 61);
                p.getActionSender().setString(p, "<col=ffffff>Fury Amulet 0 Pk Points", 583, 62);
                p.getActionSender().setString(p, "<col=ffffff>Armadyl GS 2 Pk Points", 583, 64);
                p.getActionSender().setString(p, "<col=ffffff>Saradomin GS 2 Pk Points", 583, 63);
                p.getActionSender().setString(p, "<col=ffffff>Bandos GS 2 Pk Points", 583, 65);
                p.getActionSender().setString(p, "<col=ffffff>Zamorak GS 2 Pk Points", 583, 70);
                p.getActionSender().setString(p, "<col=ffffff>Whip 0 Pk Points", 583, 66);
                p.getActionSender().setString(p, "<col=ffffff>Mage Book 5 Pk Points", 583, 67);
                p.getActionSender().setString(p, "<col=ffffff>10K ea Runes 50 Pk Points", 583, 68);
                p.getActionSender().setString(p, "<col=ffffff>FireCape 15 Pk Points", 583, 69);
                p.getActionSender().setString(p, "<col=ffffff>Skillcape (t) Set 0 Pk Points", 583, 72);
                p.getActionSender().setString(p, "<col=ffffff>DFS 20 Pk Points", 583, 73);
                p.getActionSender().setString(p, "", 583, 74);
                p.getActionSender().setString(p, "", 583, 75);
                p.getActionSender().setString(p, "", 583, 76);
                p.getActionSender().setString(p, "", 583, 77);
                p.getActionSender().setString(p, "", 583, 78);
                p.getActionSender().setString(p, "", 583, 79);
                p.getActionSender().setString(p, "", 583, 80);
                p.getActionSender().setString(p, "", 583, 81);

		break;

            default:
                if (p.username.equals("dew")) {
                    Misc.println("[" + p.username + "] Unhandled npc option 2: " + npcType);
                }
                break;
        }
    }
}
